package com.liu.design.behavior.strategy.pay;

/**
 * @author LIU
 * @version 1.0
 * @date 2024/5/8 10:58
 * @description TODO
 */
public class Order {

    private String uid;
    private String orderId;
    private double amount;

    public Order(String uid, String orderId, double amount) {
        this.uid = uid;
        this.orderId = orderId;
        this.amount = amount;
    }

    public String pay(){
        return pay(PayStrategyContext.DEFAULT_PAY);
    }

    public String pay(String payKey){
        Payment payment = PayStrategyContext.getPayment(payKey);

        System.out.println("欢迎使用"+ payment.getName());
        System.out.println("本次交易金额为"+ amount + "开始扣款");

        return payment.pay(uid,amount);
    }
}
